package vip.xiaonuo.smzq.modular.kcl.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import vip.xiaonuo.smzq.modular.kcl.entity.Zycl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 资源储量 Mapper
 *
 * @author eomer
 * @since 2024-02-22
 */
@Mapper
public interface ZyclMapper extends BaseMapper<Zycl> {

    //查询当前矿当前年度的矿石种类
    @Select("select kslx from kcl_zycl where kqbh=#{kqbm} and djflbh=#{djflbm} and nd=#{nd} GROUP BY kslx")
    List<Integer> getKslxList(@Param("kqbm") String kqbm, @Param("djflbm")Integer djflbm, @Param("nd")Integer nd);
    //查询当前矿当前年度的矿石种类
    @Select("select kslx from kcl_zycl where kqbh=#{kqbm}  and nd=#{nd} GROUP BY kslx")
    List<Integer> getKslxListNoDjflbm(@Param("kqbm") String kqbm, @Param("nd")Integer nd);
    /**
     * 同矿年度下拉框
     *
     * @Param kqbm 矿区编码
     * @Param djflbm 登记分类编码
     */
    @Select("select nd from kcl_zycl where kqbh=#{kqbm} and djflbh=#{djflbm} GROUP BY nd")
    List<Integer> getNdList(@Param("kqbm") String kqbm, @Param("djflbm")Integer djflbm);

    //查询当前矿当前年度的矿产类型
    @Select("select kcdm from kcl_zycl where kqbh=#{kqbm} and djflbh=#{djflbm} and nd=#{nd} GROUP BY kcdm")
    List<Integer> getKcList(@Param("kqbm") String kqbm, @Param("djflbm")Integer djflbm, @Param("nd")Integer nd);


    //查询当前矿山的矿产代码-统计对象
    @Select("SELECT CONCAT(kcdm,',', tjdx) AS kslxpj from kcl_zycl where kqbh=#{kqbm} and djflbh=#{djflbm} and nd=#{nd} GROUP BY kslxpj")
    List<String> getKcdmist(@Param("kqbm") String kqbm, @Param("djflbm")Integer djflbm, @Param("nd")Integer nd);
}
